<template>
  <by-background />

  <view>
    <by-navigation-bar :title="page.title" />

      <component :is="page.component"></component>
  </view>
</template>

<script setup lang="ts">
import RechargeAgreement from './recharge-agreement.vue' // 0 充值协议
import UserAgreement from './user-agreement.vue' // 1 用户协议
import PrivacyPolicy from './privacy-policy.vue' // 2 隐私政策
import LiabilityStatement from './liability-statement.vue' // 3 责任声明
import PlatformQualification from './platform-qualification.vue' // 4 平台资质
import type { AnyObject } from '@/common/types'

const pages = [
  { title: '用户充值协议', component: RechargeAgreement },
  { title: '用户协议', component: UserAgreement },
  { title: '隐私政策', component: PrivacyPolicy },
  { title: '责任声明', component: LiabilityStatement },
  { title: '平台资质', component: PlatformQualification }
]
const page = shallowRef<AnyObject>({})

onLoad((e) => {
  page.value = pages[parseInt(e?.type)]
})
</script>

<style scoped lang="scss">

</style>
